home *** CD-ROM | disk | FTP | other *** search
- {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- (c) TechInsite Pty. Ltd.
- PO Box 429, Abbotsford, Melbourne. 3067 Australia
- Phone: +61 3 9419 6456
- Fax: +61 3 9419 1682
- Web: www.techinsite.com.au
- EMail: peter_hinrichsen@techinsite.com.au
-
- Created: Jan 2000
-
- Notes: Popup dialog to edit an EAddress
-
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
- unit FEditEAddress;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls, ExtCtrls, tiButtonPanel, Adrs_BOM ;
-
- type
- TFormEditEAddress = class(TForm)
- cbAddressType: TComboBox;
- eAddress: TEdit;
- tiButtonPanel1: TtiButtonPanel;
- Label1: TLabel;
- Label2: TLabel;
- procedure tiButtonPanel1Btn1Click(Sender: TObject);
- procedure tiButtonPanel1Btn2Click(Sender: TObject);
- private
- FData: TEAddress;
- procedure SetData(const Value: TEAddress);
- { Private declarations }
- public
- Property Data : TEAddress read FData write SetData ;
- end;
-
- implementation
-
- {$R *.DFM}
-
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- // *
- // * TFormEditEAddress
- // *
- // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- // Set the form's data property and assign data to the GUI
- procedure TFormEditEAddress.SetData(const Value: TEAddress);
- begin
- FData := Value;
- cbAddressType.ItemIndex := cbAddressType.Items.IndexOf( FData.EAdrsType ) ;
- eAddress.Text := FData.Text ;
- end;
-
- // OK button's OnClick event
- //------------------------------------------------------------------------------
- procedure TFormEditEAddress.tiButtonPanel1Btn1Click(Sender: TObject);
- begin
- if cbAddressType.ItemIndex = -1 then begin
- cbAddressType.SetFocus ;
- raise exception.Create( 'Please enter an EAddress type.' ) ;
- end ;
-
- if eAddress.Text = '' then begin
- eAddress.SetFocus ;
- raise exception.Create( 'Please enter a phone number / EAddress.' ) ;
- end ;
-
- FData.EAdrsType := cbAddressType.Items[cbAddressType.ItemIndex] ;
- FData.Text := eAddress.Text ;
-
- ModalResult := mrOK ;
-
- end;
-
- // Cancel button's OnClick event
- //------------------------------------------------------------------------------
- procedure TFormEditEAddress.tiButtonPanel1Btn2Click(Sender: TObject);
- begin
- ModalResult := mrCancel ;
- end;
-
- end.
-